<template>
    <van-sticky>
        <van-nav-bar title="首页" left-text="返回" left-arrow @click-left="onClickLeft" />
    </van-sticky>
    <div>
        <van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
            <van-swipe-item v-for="(item, index) in arr" :key="index">
                <img :src="item.image_src" class="lb" />
            </van-swipe-item>
        </van-swipe>
    </div>
    <div v-for="(item, index) in brr" :key="index">
        <img :src="item.image_src" alt="" class="dh">
    </div>
    <div v-for="(item, index) in crr" :key="index">
        <img width="100%" :src="item.floor_title.image_src" alt="">
        <div v-for="(items, index) in item.product_list" :key="index">
            <img width="100%" height="200%" :src="items.image_src" alt="">
        </div>
    </div>
</template>

<script setup>
import { ref } from 'vue';
import axios from 'axios';
let arr = ref([])
let brr = ref([])
let crr = ref([])
axios.get('https://api-hmugo-web.itheima.net/api/public/v1/home/swiperdata').then(res => {
    arr.value = res.data.message
})
axios.get('https://api-hmugo-web.itheima.net/api/public/v1/home/catitems').then(res => {
    brr.value = res.data.message
})
axios.get('https://api-hmugo-web.itheima.net/api/public/v1/home/floordata').then(res => {
    crr.value = res.data.message
})
const onClickLeft = () => history.back();
</script>

<style>
.my-swipe .van-swipe-item {
    width: 400px;
    height: 200px;
}

.lb {
    width: 400px;
    height: 200px;
}

.dh {
    float: left;
    width: 90px;
    height: 80px;
}
</style>